package strategy;

import strategy.pojo.Context;
import strategy.service.impl.AddStrategy;
import strategy.service.impl.SubStrategy;
//TODO 定义一系列的算法,把它们一个个封装起来, 并且使它们可相互替换。
public class demo {
    public static void main(String[] args) {
        AddStrategy addStrategy = new AddStrategy();
        Context context = new Context(addStrategy);
        int execute = context.execute(10, 10);
        System.out.println("加法计算结果："+execute);
        context = new Context(new SubStrategy());
        int execute1 = context.execute(10, 10);
        System.out.println("减法计算结果："+execute1);

    }
}
